/*
 * Middleware
 * Copyright (C) 2010/11
 * Riccardo Pulvirenti, Giuseppe Ravidà, Andrea Tino
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANDABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses
 */

/*!
 * File: address_test.hpp
 */

#ifndef _ADDRESS_TEST_HPP_
#define _ADDRESS_TEST_HPP_

#include <iostream>
#include <string>

#include "address.hpp"

namespace middleware {
//-----------------------------------------------------------------------------
// Definitions
/*!
 * Test function for Adress
 */
void AddressTest();
//-----------------------------------------------------------------------------
// Implementations
void AddressTest() {

	InetIpAddr newIP;
	InetPort newPort;

	/*!
	 * Testing construct.
	 */
	Address ad1;

	/*!
	 * Testing construct with parameters.
	 */
	Address ad2("192.168.1.2",40673);

	/*!
	 * Testing Sets IP address & port.
	 */
	ad1.set_ip("192.168.1.1");
	ad1.set_port(40672);

	/*!
	 * Testing Gets IP address & port.
	 */
	newIP = ad1.get_ip();
	newPort = ad1.get_port();
	/*
	 * Print first address
	 */
	cout << "primo IP: "<< newIP << endl;
	cout << "primo port: "<< newPort << endl;
	/*
	 * Print second address
	 */
	cout << "secondo IP: "<< ad2.get_ip() << endl;
	cout << "secondo port: "<< ad2.get_port() << endl;

}
}
#endif
